#include "settings.h"
#include <iostream>
#include <QMessageBox>
using namespace std;
Settings::Settings(QObject * parent){
cout<<"set1";

    QString path;
        // determine path for application data dirs
#ifdef Q_OS_WIN32

        wchar_t buf[MAX_PATH];
        if (!SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, 0, buf))
                path = QString::fromUtf16((ushort *)buf)+"/";

        else
                path = QDir::homePath()+"/Application Data/"; // this shouldn't happen

//        path = "%APPDATA%\\";
#else
cout<<"set2";
               path = QDir::homePath()+"/";
#endif //Q_OS_WIN32

cout<<"set3";
        QDir dir(path);
#ifdef Q_OS_WIN32
        dir.mkdir("QtDict");
        path += "QtDict\\";
#else
cout<<"set4";
        dir.mkdir(".qtdict");
cout<<"set5";
        path += ".qtdict/";
#endif
    cout<<"set6";
    path+="qtdict.conf";
//    QMessageBox msgBox;
//    msgBox.setText("The current path is: "+path);
//    msgBox.exec();
    qsts=new QSettings(path,QSettings::IniFormat,parent);
}

